<?php
/**
 * Joomla! 1.5 component JoomGPSTracks
 *
 * @version $Id: controller.php 2009-06-24 15:40:19 svn $
 * @author Michael Pfister
 * @package joomGPStracks
 * @subpackage backend
 * @license GNU/GPL
 * @filesource
 *
 */

// no direct access
defined('_JEXEC') or die('Restricted access');

jimport( 'joomla.application.component.controller' );
require_once( JPATH_COMPONENT.DS.'helpers'.DS.'helper.php' );

/**
 * maincontroller for backend
 */
class JoomgpstracksController extends JController {

    /**
     * 
     */
    function __construct() {
        parent::__construct();

        $this->registerTask( 'savecat'      ,   'savecat' );
    }

    /**
     * @use get task form uri and set view and layout
     */
    function display()  {
        switch($this->getTask()) {
            default:
                JRequest::setVar('view',    'default');
                break;

            case 'config':
                JRequest::setVar('view',    'config');
                JRequest::setVar('layout',   'default');
                break;

            case 'cats':
                JRequest::setVar('view',    'cats');
                JRequest::setVar('layout',  'default');
                break;
            
            case "newcat":
                JRequest::setVar('view',   'cats' );
                JRequest::setVar('layout',   'form' );
                break;

            case "editcat":
                JRequest::setVar('view',    'cats');
                JRequest::setVar('layout',  'editform');
                break;

            case "tracks":
                JRequest::setVar('view',    'tracks');
                JRequest::setVar('layout',  'default');
                break;

            case "newtrack":
            case "editTrack":
                JRequest::setVar('view',    'tracks');
                JRequest::setVar('layout',  'form');
                break;

            case "terrain":
                JRequest::setVar('view',    'terrain');
                JRequest::setVar('layout',  'default');
                break;

            case "newterrain":
                JRequest::setVar('view',    'terrain');
                JRequest::setVar('layout',  'form');
                break;

            case "comments":
                JRequest::setVar('view',    'comments');
                JRequest::setVar('layout',  'default');
                break;

            case "editComment":
                JRequest::setVar('view',    'comments');
                JRequest::setVar('layout',  'form');
                break;
        }
        parent::display();
    }
}
?>